package com.epoint.mvc.index;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.*;

@RestController
public class RESTfulController {

    @GetMapping("/user/{id}")
    public String getUser(@PathVariable("id") String id){
        System.out.println("查询用户，id = " + id);

        return "200";
    }

    @DeleteMapping("/user/{id}")
    public Map<String, Object> delUser(@PathVariable("id") String id){
        System.out.println("删除用户，id = " + id);

        Map<String, Object> jsonObject = new HashMap<>();
        jsonObject.put("code", "200");
        jsonObject.put("msg", "删除用户，id = " + id);
        return jsonObject;
    }

    @PostMapping("/user")
    public String addUser(@RequestParam("params") String params){
        System.out.println("新增用户，params = " + params);
        return "200";
    }



}
